#ifndef MLANG_MAIN_MLANG_MLANGMODULE_H
#define MLANG_MAIN_MLANG_MLANGMODULE_H

#include <Define.h>

namespace multilang {

// 统一使用Java类型描述符，很方便
// B byte
// C char
// S short
// I int
// J long
// F float
// D double
// Z boolean
// L...; class ref

class MlangModule {
public:
    virtual MlangClass* findClass(const char* name) = 0;
    virtual MlangFunc* findFunc(const char* name, const char* type) = 0;
};

class MlangClass {
protected:
    union {
        struct {
            void* clazz;
        } java;
    };

public:
    virtual MlangObject* createObject() = 0;
    virtual MlangFunc* findConstructor(const char* type) = 0;
    virtual MlangFunc* findFunc(const char* name, const char* type) = 0;
    virtual MlangFunc* findDestructor(const char* type) = 0;
};

class MlangFunc {
protected:
    union {
        struct {
            void* method;
        } java;
    };

public:
    virtual const char* getType() = 0;
    virtual byte_t callByte(...) = 0;
    virtual short_t callShort(...) = 0;
    virtual int_t callInt(...) = 0;
    virtual long_t callLong(...) = 0;
    virtual float_t callFloat(...) = 0;
    virtual double_t callDouble(...) = 0;
    virtual bool_t callBool(...) = 0;
    virtual object_t callObject(...) = 0;
};

}

#endif